package ch2.ex5;

import static ch2.ex1.Print.*;

class Dog{
	
	String name;
	String says;
	
	void setName(String name){
		this.name = name;
	}
	void setSays(String says){
		this.says = says;
	}
	void showName(){
		println(name);
	}
	void speak(){
		println(says);
	}
	
}
public class DogTest {
	public static void main(String[] args){
		Dog spot = new Dog();
		spot.setName("Spot");
		spot.setSays("Ruff!");
		
		Dog spotty = new Dog();
		spotty.setName("Test");
		spotty.setSays("Hello!");
		
		Dog scruffy = new Dog();
		scruffy.setName("Scruffy");
		scruffy.setSays("Wurf!");
		spot.showName();
		spot.speak();
		scruffy.showName();
		scruffy.speak();
		
		System.out.println("1: spot == spotty - " + (spot == spotty));
		System.out.println("2: spot.equals(spotty) - " + (spot.equals(spotty)));
		spot = spotty;
		System.out.println("3: spot.equals(spotty) - " + (spot.equals(spotty)));
		spot.showName();
		spot.speak();
		spotty.showName();
		spotty.speak();
	}
}
